package com.sunny.design.observer.events;

/**
 * @author Sunny
 * @date 2020/1/15
 */
public class MouseEventTest {

    public static void main(String[] args) {
        MouseEventCallback callback = new MouseEventCallback();

        Mouse mouse = new Mouse();

        //注册事件回调
        mouse.addListener(MouseEventType.ON_CLICK, callback);
        mouse.addListener(MouseEventType.ON_DOUBLE_CLICK, callback);
        mouse.addListener(MouseEventType.ON_BLUR, callback);
        mouse.addListener(MouseEventType.ON_DOWN, callback);

        //执行事件
        mouse.click();
        mouse.blur();
    }
}
